package metrics

import (
	"github.com/prometheus/client_golang/prometheus"
	"github.com/prometheus/client_golang/prometheus/promauto"
)

var (
	// 在线设备数
	OnlineDevices = promauto.NewGauge(prometheus.GaugeOpts{
		Name: "worktool_online_devices",
		Help: "当前在线设备数",
	})

	// 消息计数器
	MessageCounter = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "worktool_messages_total",
		Help: "消息总数",
	}, []string{"type", "status"})

	// 消息处理延迟
	MessageLatency = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "worktool_message_latency_seconds",
		Help:    "消息处理延迟(秒)",
		Buckets: prometheus.DefBuckets,
	}, []string{"type"})

	// API请求计数器
	APIRequestCounter = promauto.NewCounterVec(prometheus.CounterOpts{
		Name: "worktool_api_requests_total",
		Help: "API请求总数",
	}, []string{"method", "path", "status"})

	// API请求延迟
	APILatency = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Name:    "worktool_api_latency_seconds",
		Help:    "API请求延迟(秒)",
		Buckets: prometheus.DefBuckets,
	}, []string{"method", "path"})

	// 用户活跃度
	ActiveUsers = promauto.NewGauge(prometheus.GaugeOpts{
		Name: "worktool_active_users",
		Help: "当前活跃用户数",
	})

	// 机器码使用情况
	RobotCodeUsage = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Name: "worktool_robot_codes",
		Help: "机器码使用情况",
	}, []string{"status"})
) 